package org.jeecg.modules.monitoring.j_monitoring.service.impl;

import org.jeecg.modules.monitoring.j_monitoring.entity.MCabinet;
import org.jeecg.modules.monitoring.j_monitoring.entity.MMachineRoom;
import org.jeecg.modules.monitoring.j_monitoring.mapper.MMachineRoomMapper;
import org.jeecg.modules.monitoring.j_monitoring.service.IMMachineRoomService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 机房
 * @Author: xiaoyq
 * @Date:   2023-02-22
 * @Version: V1.0
 */
@Service
public class MMachineRoomServiceImpl extends ServiceImpl<MMachineRoomMapper, MMachineRoom> implements IMMachineRoomService {
    public List<MMachineRoom> getAllList(){
        return baseMapper.selectAll();
    }

    @Override
    public void batchUpdateMachineName(String roomName, String roomId) {
        baseMapper.updateMachineRoomName(roomName,roomId);
    }

    public String getId(String name,List<MMachineRoom> roomList){
        for (MMachineRoom room : roomList){
            if (name.equals(room.getName())){
                return room.getId();
            }
        }
        return "";
    }
}
